package vn.lumi.smarthome.network;

import vn.lumi.smarthome.LumiHome;
import vn.lumi.smarthome.ulti.Preference;
import android.content.Context;

public class AckScene extends HCMsg{

	//constants
	private static int LENGTH = 5;
	
	//position of byte
	public static final int CmdIdPos = 0;
	public static final int MsgIdPos = 1;
	public static final int UserIdPos=2;
	public static final int SceneIdPos=3;
	public static final int NewConfigPos=4;
	
	//attributes
	private int Scene_id = 0;
	private int user_id = 0;
	private int newConfigVersion = 0;
	
	public AckScene() {
		super(NetMessage.CMD_HC_ACK_SCENE, 0, LENGTH);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void parseMessage(byte[] input, int length) {
		// TODO Auto-generated method stub
		if(isCorrectFormat(input, length) == true){
			Msg_id = Byte2Unsigned(input[1]);
			this.user_id = Byte2Unsigned(input[2]);
			Scene_id = Byte2Unsigned(input[3]);
			this.newConfigVersion = Byte2Unsigned(input[4]);
			System.out.println("AckScene: Msg_id = " + Msg_id + " Scene id = " + Scene_id +" user_id="+this.user_id+" config version="+this.newConfigVersion);
		}
	}
	
	public int getSceneID(){
		return Scene_id;
	}

	public int getConfigVersion(){
		return this.newConfigVersion;
	}
	
	public int getUserId(){
		return this.user_id;
	}
	@Override
	public void doWhenReceived(Context context) {
		// TODO Auto-generated method stub
		
		
	}

}
